package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 交易流程规则配置的关联商品
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-24
 */
@Entity
@Table(schema = "public", name = "ord_trade_process_product", indexes = {@Index(name = "ord_trade_process_product_process_id_idx", columnList = "trade_process_id"), @Index(name = "ord_trade_process_product_product_id_idx", columnList = "productId"), @Index(name = "ord_trade_process_product_sku_id_idx", columnList = "skuId"), @Index(name = "ord_trade_process_product_name_idx", columnList = "name")})
public class OrderTradeProcessProductDO implements Serializable {
    private static final long serialVersionUID = -3926864382670514376L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_trade_process_product_seq")
    @SequenceGenerator(sequenceName = "ord_trade_process_product_seq", name = "ord_trade_process_product_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联交易流程规则
     */
    @JsonBackReference
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "trade_process_id")
    private OrderTradeProcessDO process;

    /**
     * 商品Id
     */
    @Column
    private Long productId;

    /**
     * 商品SkuId
     */
    @Column
    private Long skuId;

    /**
     * 商品名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String name;

    /**
     * 商品品类
     */
    @Column(columnDefinition = "varchar(50)")
    private String category;

    /**
     * 商品品牌
     */
    @Column(columnDefinition = "varchar(50)")
    private String brand;

    /**
     * 商品定价类型，定义在 PriceTypeEnum 中，1-现货价格，2-价格需要询价，3-积分兑换商品
     */
    @Column
    private Integer priceType;

    /**
     * 商品类型（标识是会员商品，还是渠道商品）
     */
    @Column
    private Integer productType;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public OrderTradeProcessDO getProcess() {
        return process;
    }

    public void setProcess(OrderTradeProcessDO process) {
        this.process = process;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Integer getPriceType() {
        return priceType;
    }

    public void setPriceType(Integer priceType) {
        this.priceType = priceType;
    }

    public Integer getProductType() {
        return productType;
    }

    public void setProductType(Integer productType) {
        this.productType = productType;
    }
}
